package com.example.demo.controller;

import com.example.demo.entity.Order;
import com.example.demo.entity.Order2;
import com.example.demo.impl.OrdersImpl;
import com.example.demo.mapper.OrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.expression.spel.ast.NullLiteral;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/Order2")
@CrossOrigin(origins="http://localhost:8080")
public class Orderscontroller {

    @Autowired
    OrdersImpl OrdersService;

    @GetMapping("/getall")
    public Object findall()
    {
        return OrdersService.getListall();
    }

    @GetMapping("/getrelaid")
    public Object findgoods_Byrelaid(Integer relaid)
    {

        if(relaid != null){
            return OrdersService.getrelaidList(relaid);

        }
        else {
            return OrdersService.getListall();
        }
    }

    @GetMapping("/modify1")
    public boolean modify1(int numid,int relaid)
    {
        OrdersService.modify1(numid, relaid);
        return true;
    }

    @GetMapping("/modify12")
    public Object modify12(int numid,int relaid)
    {
        return OrdersService.getmodify(numid,relaid);
    }
    @GetMapping("/modify13")
    public Object modify13(int numid,int relaid)
    {
        return OrdersService.getmodify3(numid,relaid);
    }

    @GetMapping("/modify14")
    public Object modify14(int numid,int relaid)
    {
        return OrdersService.getmodify4(numid,relaid);
    }


}
